namespace CheckoutCodeKata
{
    public class QuantityPrice : IPriceRule
    {
        private readonly PriceList _priceList;
        private readonly Counter _counter;

        public QuantityPrice(PriceList priceList, Counter counter)
        {
            _priceList = priceList;
            _counter = counter;
        }

        public void CalculatePrice(string code, int quantity)
        {
            var price = _priceList.GetPrice(code);
            _counter.IncrementBy(price*quantity);
        }
    }
}